package com.gbits.app.finance.convert;

import java.util.List;
import java.util.Map;

import com.gbits.app.finance.api.CreditItemConvert;
import com.gbits.app.finance.domain.Subject;

public class BankCreditSubjectConvert extends CreditItemConvert {

	@Override
	public String getUsageInfo(Map<String, Object> map) {
		return this.getUsage(map) + SUBJECT_SPLIT + this.getAccountName(map);
	}

	@Override
	public String getSubjectDetail(Map<String, Object> map) {
		String pay_bank_no = map.get("pay_bank_no").toString();
		List<Subject> list = this.getSubjectService().getSubjectsByBankNo(pay_bank_no, map.get("company_str").toString());
		StringBuffer sb = new StringBuffer();
		sb.append(list.get(list.size() - 1).getCode());
		for(Subject s : list) {
			sb.append(SUBJECT_SPLIT + s.getName());
		}
		return sb.toString();
	}

	@Override
	public String getCreditAmount(Map<String, Object> map) {
		return this.getAmount(map);
	}

}
